﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace EClinic.Ontology
{
    

    public partial class Ontology_Editor : UserControl
    {
        public Ontology_Editor()
        {
            InitializeComponent();
        }


        private void radMenuButtonItem1_Click(object sender, EventArgs e)
        {
            if (radTreeView1.SelectedNode.GetNodeCount(true)==0)
            {
                Telerik.WinControls.UI.RadPageViewPage x = new Telerik.WinControls.UI.RadPageViewPage();
                x.CreateControl();
                x.Text = "New Property";
                OSubNodeEdit c = new OSubNodeEdit();
                c.CreateControl();
                c.Dock = DockStyle.Fill;
                x.Controls.Add(c);

                Program.Prog.PatientsEditorWindow.Pages.Add(x);
                Program.Prog.PatientsEditorWindow.SelectedPage = x;
            }
            if (radTreeView1.SelectedNode.GetNodeCount(true) > 0)
            {
                Telerik.WinControls.UI.RadPageViewPage x = new Telerik.WinControls.UI.RadPageViewPage();
                x.CreateControl();
                x.Text = "New Part";
                TreeMainNodeEdit c = new TreeMainNodeEdit();
                c.CreateControl();
                c.Dock = DockStyle.Fill;
                x.Controls.Add(c);

                Program.Prog.PatientsEditorWindow.Pages.Add(x);
                Program.Prog.PatientsEditorWindow.SelectedPage = x;
            }
           
        }

        private void Ontology_Editor_Load(object sender, EventArgs e)
        {
            Ontology x = new Ontology();
            foreach (var item in x.podyparts)
            {
                radTreeView1.Nodes["Body Parts"].Nodes.Add(new Telerik.WinControls.UI.RadTreeNode(item.name));
                    foreach (var item2 in item.property)
                     {
                         radTreeView1.Nodes["Body Parts"].Nodes[item.name].Nodes.Add(new Telerik.WinControls.UI.RadTreeNode(item2.name));
                     }
            }
           // radTreeView1.Nodes["Body Parts"].Nodes.Add("x").Nodes.Add("y");

        }
    }
}
